const mysql = require('../../mysql')

async function  goods_qurty(ctx) {
  const { serial_number } = ctx.request.body

  const goods_info = await mysql('goods')
                            .where({serial_number})
                            .select()
  
  const order_info = await mysql('goods_sold')
                            .where({'goods_id': goods_info[0].id})
                            .select()
  const parameter = await mysql('goods_dispensable_parameter')
                          .where({'goods_id': goods_info[0].id})
                          .select()
  
  ctx.state.data = {
    goods_name: goods_info[0].goods_name,
    order_info: order_info[0],
    parameter
  } 

}


module.exports = {
  goods_qurty
}